package com.micro.modual.service.impl;

import com.micro.common.MicroResponseCode;
import com.micro.core.exception.BizException;
import com.micro.core.frame.service.impl.AbstractBasicsServiceImpl;
import com.micro.core.resp.RespJson;
import com.micro.modual.entity.GoodsBrandAuthorize;
import com.micro.modual.extension.GoodsBrandAuthorizeExtension;
import com.micro.modual.mapper.GoodsBrandAuthorizeMapper;
import com.micro.modual.model.bo.goodsbrandauthorize.GoodsBrandAuthorizeBO;
import com.micro.modual.service.GoodsBrandAuthorizeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


/**
*  <h1>品牌资质授权表  实现</h1>
 * @author LevelCoder
 * @version V1.0.0
 * @email LevelCoder@126.com
 * @date 2020-08-04 00:11:10
 */
@Service("goodsBrandAuthorizeService")
public class GoodsBrandAuthorizeServiceImpl extends AbstractBasicsServiceImpl<GoodsBrandAuthorize,Long> implements GoodsBrandAuthorizeService {

    @Autowired
    private GoodsBrandAuthorizeMapper goodsBrandAuthorizeMapper;

    /**
     * <h2>新增品牌资质授权表详情</h2>
     * @param goodsBrandAuthorizeBO {@link GoodsBrandAuthorizeBO} 品牌资质授权表 新增/修改 请求对象
     * @return {@link RespJson} 返回结果基础类
     */
    @Override
    public RespJson addGoodsBrandAuthorize(GoodsBrandAuthorizeBO goodsBrandAuthorizeBO) {
        GoodsBrandAuthorize goodsBrandAuthorize = GoodsBrandAuthorizeExtension.converAddGoodsBrandAuthorize(goodsBrandAuthorizeBO);
        goodsBrandAuthorizeMapper.insertSelective(goodsBrandAuthorize);
        return new RespJson(MicroResponseCode.SUCCESS.getResponseCode(), MicroResponseCode.SUCCESS.getResponseMessage());
    }

    /**
     * <h2>修改品牌资质授权表详情</h2>
     * @param goodsBrandAuthorizeBO  {@link GoodsBrandAuthorizeBO} 品牌资质授权表 新增/修改 请求对象
     * @return {@link RespJson} 返回结果基础类
     */
    @Override
    public RespJson editGoodsBrandAuthorize(GoodsBrandAuthorizeBO goodsBrandAuthorizeBO) {
        GoodsBrandAuthorize goodsBrandAuthorize = GoodsBrandAuthorizeExtension.converEditGoodsBrandAuthorize(goodsBrandAuthorizeBO);
        goodsBrandAuthorizeMapper.updateByPrimaryKeySelective(goodsBrandAuthorize);
        return new RespJson(MicroResponseCode.SUCCESS.getResponseCode(),MicroResponseCode.SUCCESS.getResponseMessage());

    }

    /**
     * <h2>根据主键编号删除品牌资质授权表信息</h2>
     * @param id  品牌资质授权表 主键编号
     * @return  {@link RespJson} 返回结果基础类
     */

    @Override
    public RespJson deleteGoodsBrandAuthorize(Long id) {
        goodsBrandAuthorizeMapper.deleteByPrimaryKey(id);
        return new RespJson(MicroResponseCode.SUCCESS.getResponseCode(),MicroResponseCode.SUCCESS.getResponseMessage());
    }

}
